// 二维数组写入表格函数
function table(name) {
    for (let i = 0; i < name.length; i++) {
        document.write(`
    <tr>
        <td>${i + 1}</td>
        <td>${name[i][0]}</td>
        <td>${name[i][1]}</td>
        <td>${name[i][2]}</td>
    </tr>
        `)
    }
}

// 九九乘法表函数
function chengFa99(level) {
    for (let i = 1; i <= level; i++) {
        for (let j = 1; j <= i; j++) {
            document.write(`${j} * ${i} = ${j * i} &nbsp;&nbsp;`)
        }
        document.write('<br>')
    }
}
// 去掉数组指定元素函数
function arrTrip(a, b) {
    let newArr = [];
    for (let i = 0; i < a.length; i++) {
        if (arr[i] != b) {
            newArr[newArr.length] = arr[i]
        }
    }
    return newArr
}

//验证数组里的元素是否正数
function yanZheng(a) {
    let min = Infinity;
    for (let i = 0; i < a.length; i++) {
        if (a[i] < min) {
            min = a[i]
        }
    }
    if (min < 0) {
        min = 'true'
    } else {
        min = 'flase'
    }
    return min;
}

//求数组最小值
function getArrMin(a) {
    let min = Infinity;
    for (let i = 0; i < a.length; i++) {
        if (a[i] < min) {
            min = a[i];
        }
    }
    return min
}

// 求数组最大值
function getArrMax(a) {
    let max = -Infinity;
    for (let i = 0; i < a.length; i++) {
        if (a[i] > max) {
            max = a[i];
        }
    }
    return max
}

//求数组的和
function getArrSum(a) {
    let sum = 0;
    for (let i = 0; i < a.length; i++) {
        sum += a[i];
    }
    return sum
}

//求数组平均值
function getArrMean(a) {
    let sum = 0;
    for (let i = 0; i < a.length; i++) {
        sum += a[i];
    }
    return sum / a.length
}

//数组翻转
function getArrFan(a) {
    for (let i = 0; i < a.length / 2; i++) {
        let temp = a[i];
        a[i] = a[a.length - 1 - i];
        a[a.length - 1 - i] = temp
    }
    return a
}